﻿using CommunityToolkit.Mvvm;
using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
using HandyControl.Data;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Drawing;
using System.Globalization;
using System.Linq;
using System.Net;
using System.Net.Sockets;
using System.Reflection.Emit;
using System.Runtime.InteropServices;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Forms;
using System.Windows.Markup;
using System.Windows.Media;
using static System.Windows.Forms.VisualStyles.VisualStyleElement.Button;
using static System.Windows.Forms.VisualStyles.VisualStyleElement.ListView;


namespace 转台控制WIN版2024
{
    public partial class MainWindowViewModel : ObservableObject
    {
        public MainWindowViewModel()
        {
            MotionDevice=new MotionDevice();
            MotionDevice.Axes=new ObservableCollection<MotionAxis>();
            MotionDevice.Axes.Add(
                new MotionAxis()
                {
                    ID=1,
                    Name="方位轴"
                }
                );
            MotionDevice.Axes.Add(
                new MotionAxis()
                {
                    ID = 2,
                    Name = "俯仰轴"
                }
                );
            MotionDevice.Axes.Add(
                new MotionAxis()
                {
                    ID = 3,
                    Name = "滚转"
                }
                );
        }

        [ObservableProperty]
        private IMotionDevice motionDevice;


        [ObservableProperty]
        private MotionAxis selectMotionAxis;


        [RelayCommand]
        public void Select(object obj)
        {
            foreach(var temp in MotionDevice.Axes)
            {
                if(temp.Selected)
                {
                    SelectMotionAxis = temp;
                    return;
                }
            }
        }
    }




}
